<?php
namespace app\api\model;
use plugin\filter;
use think\Db;
use think\Model;
use app\api;

/*用户信息模型*/
class MaliceIp extends CommonModel
{
    private $table_name = 'malice_ip';
    public function __construct($args = [])
    {
        parent::__construct($args);
    }

    //获取所有禁用的ip
    public function getAllIp()
    {
        $data = db($this->table_name)->select();
        $ipList = [];
        if(!empty($data))
        {
            foreach($data as $v)
            {
                $ipList[] = $v['ip'];
            }
        }
        return $ipList;
    }

    //添加
    public function add($ip)
    {
        if(empty($ip))
        {
            return false;
        }
        db($this->table_name)->insert(['ip'=>$ip]);
        return true;
    }

}